Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX: Copy interface before running to prevent task mutation on run #12

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

effigies
Copy link
Contributor

Test still needed.

@effigies
Copy link
Contributor Author

effigies commented May 1, 2021

@JW-96 Do you happen to remember an interface that was changing hash before and after run? I can't remember how to create this condition to write a test.

@JeffWigger
Copy link

I think it was due to the paths in the docker image, on which I run the workflow, being different to the paths on my system. However, I will rerun the workflow and check again.

@JeffWigger
Copy link

Originally we had the problem with ApplyTransforms of Ants, but I did not get it again. However, for Normalize12 of SPM I get:

>>> t = load_task("/home/cache_part1_fix_chris_test2/Nipype1Task_d9baecc08957742c186ec5f8c5f1cbfe1b8f6624eae11dc73ef0222d54199afa/_task.pklz")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/pydra/pydra/engine/helpers.py", line 819, in load_task
    task = cp.loads(task_pkl.read_bytes())
  File "/opt/miniconda-latest/envs/fcbg38/lib/python3.8/site-packages/traits/has_traits.py", line 1341, in __setstate__
    self.trait_set(trait_change_notify=trait_change_notify, **state)
  File "/opt/miniconda-latest/envs/fcbg38/lib/python3.8/site-packages/traits/has_traits.py", line 1434, in trait_set
    setattr(self, name, value)
  File "/opt/miniconda-latest/envs/fcbg38/lib/python3.8/site-packages/nipype/interfaces/base/traits_extension.py", line 330, in validate
    value = super(File, self).validate(objekt, name, value, return_pathlike=True)
  File "/opt/miniconda-latest/envs/fcbg38/lib/python3.8/site-packages/nipype/interfaces/base/traits_extension.py", line 135, in validate
    self.error(objekt, name, str(value))
  File "/opt/miniconda-latest/envs/fcbg38/lib/python3.8/site-packages/traits/base_trait_handler.py", line 74, in error
    raise TraitError(
traits.trait_errors.TraitError: The 'image_to_align' trait of a Normalize12InputSpec instance must be a pathlike object or string representing an existing file, but a value of '/home/cache_part1_fix_chris_test2/Nipype1Task_d9baecc08957742c186ec5f8c5f1cbfe1b8f6624eae11dc73ef0222d54199afa/normalize2_con/sub-04_t1w_preproc.nii' <class 'str'> was specified.

With the directory looking like this:

root@a11df7db765e:/home/pydra-glm-example/pydra_version# ls /home/cache_part1_fix_chris_test2/Nipype1Task_d9baecc08957742c186ec5f8c5f1cbfe1b8f6624eae11dc73ef0222d54199afa/
normalize2_con	_result.pklz  _task.pklz
root@a11df7db765e:/home/pydra-glm-example/pydra_version# ls /home/cache_part1_fix_chris_test2/Nipype1Task_d9baecc08957742c186ec5f8c5f1cbfe1b8f6624eae11dc73ef0222d54199afa/normalize2_con/
_0x1befbbe3d820fb023e02fa5c28d41651.json  _node.pklz		  _report		      wcon_0001.nii  wcon_0003.nii  wcon_0005.nii  wcon_0007.nii  wess_0009.nii		   y_sub-04_t1w_preproc.nii
_inputs.pklz				  pyscript_normalize12.m  result_normalize2_con.pklz  wcon_0002.nii  wcon_0004.nii  wcon_0006.nii  wess_0008.nii  wsub-04_t1w_preproc.nii
root@a11df7db765e:/home/pydra-glm-example/pydra_version# 

@effigies
Copy link
Contributor Author

effigies commented May 1, 2021

Does this pr address that?

@JeffWigger
Copy link

I rerun my workflow again with this pull request and the above issue with loading the Normalize12 task does no longer occur.

@effigies
Copy link
Contributor Author

effigies commented May 4, 2021

Ah, right. Thanks for the reminder of how this was exhibiting.

@codecov-commenter
Copy link

codecov-commenter commented Oct 19, 2022

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.38%. Comparing base (4c08fab) to head (1df2696).

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #12      +/-   ##
==========================================
+ Coverage   95.31%   95.38%   +0.07%     
==========================================
  Files           4        4              
  Lines          64       65       +1     
  Branches        7        7              
==========================================
+ Hits           61       62       +1     
  Misses          2        2              
  Partials        1        1              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants